export default {
    data(){
        return{
            goodsId:'',
            goodsList:[]
        }
    },
    created(){
        this.goodsId=this.$route.params.goodsId
        // console.log(this.$route.params)
        var that=this
        this.goodsList=this.$store.state.list.filter(function(list){
            return list.id==that.goodsId
        })
    },
    methods:{
      addShoppingCar(){
        this.$store.commit("addCar")
        this.goodsList[0].car_num+=1
        if(this.goodsList[0].car_num==1){
            this.$store.state.shopingList.unshift(this.goodsList[0])
        }
        // console.log(this.goodsList)
        // console.log(this.$store.state.shopingList)
      }
    }
}